export function errorHandler(err, _req, res, _next) {
  console.error(err)
  if (res.headersSent) return
  const status = err.status || 500
  res.status(status).json({ code: status, message: err.message || 'Server Error' })
}
